import { Inject, Injectable } from '@angular/core';
import { REST_URL } from '../app.component';
import { HttpService } from './http.service';
import { Observable } from 'rxjs';
import { URLConst } from '../consts/url-const';
import { ApiResult } from '../models/api.result';
import { LoginParam } from '../models/param/login-param';

@Injectable({
  providedIn: 'root'
})
export class LoginService {

  constructor(private httpService: HttpService,
    @Inject(REST_URL) private baseUrl: string) { }

    login(param: LoginParam): Observable<ApiResult<string>> {
      const url = this.baseUrl + URLConst.LOGIN_URL;
      return this.httpService.postFormData<ApiResult<string>>(url, param);
      
    //  return response.code == Consts.RESP_OK ? response.data : undefined;
    }
}
